/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Main.java
 *
 * Created on 2012-01-30, 19:54:18
 */
package pear.gui;

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Dingo
 */
public class Main extends javax.swing.JFrame {

    private NaviLogic navi;

    /**
     * Creates new form Main
     */
    public Main() {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
        initComponents();
        setLocationRelativeTo(null);
        JPanel rootPanel = new JPanel(new CardLayout());
        mainPanel.add(rootPanel, BorderLayout.CENTER);
        navi = new NaviLogic(rootPanel);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        downloadPanel = new pear.gui.DownloadPanel();
        mainPanel = new javax.swing.JPanel();
        jMenuBar = new javax.swing.JMenuBar();
        jMenuDownload = new javax.swing.JMenu();
        jMenuItemDownloadWindow = new javax.swing.JMenuItem();
        jMenuItemAddFile = new javax.swing.JMenuItem();
        jMenuItem = new javax.swing.JMenuItem();
        jMenuUpload = new javax.swing.JMenu();
        jMenuItemUploadWindow = new javax.swing.JMenuItem();
        jMenuItemUploadWizzard = new javax.swing.JMenuItem();
        jMenuUtility = new javax.swing.JMenu();
        jMenuItemCheckHash = new javax.swing.JMenuItem();
        jMenuSettings = new javax.swing.JMenu();
        jMenuItemSettings = new javax.swing.JMenuItem();
        jMenuHelp = new javax.swing.JMenu();
        jMenuPage = new javax.swing.JMenuItem();
        jMenuAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(605, 400));
        setPreferredSize(new java.awt.Dimension(605, 400));
        setResizable(false);

        mainPanel.setPreferredSize(new java.awt.Dimension(600, 359));
        mainPanel.setLayout(new java.awt.BorderLayout());

        jMenuDownload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/world.png"))); // NOI18N
        jMenuDownload.setText("Pobierz");
        jMenuDownload.setToolTipText("");

        jMenuItemDownloadWindow.setText("Okno pobierania");
        jMenuItemDownloadWindow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDownloadWindowActionPerformed(evt);
            }
        });
        jMenuDownload.add(jMenuItemDownloadWindow);

        jMenuItemAddFile.setText("Dodaj plik");
        jMenuDownload.add(jMenuItemAddFile);

        jMenuItem.setText("jMenuItem2");
        jMenuDownload.add(jMenuItem);

        jMenuBar.add(jMenuDownload);

        jMenuUpload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/package.png"))); // NOI18N
        jMenuUpload.setText("Wyślij");

        jMenuItemUploadWindow.setText("Okno wysyłania");
        jMenuItemUploadWindow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUploadWindowActionPerformed(evt);
            }
        });
        jMenuUpload.add(jMenuItemUploadWindow);

        jMenuItemUploadWizzard.setText("Kreator wysyłania");
        jMenuItemUploadWizzard.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUploadWizzardActionPerformed(evt);
            }
        });
        jMenuUpload.add(jMenuItemUploadWizzard);

        jMenuBar.add(jMenuUpload);

        jMenuUtility.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/wrench_orange.png"))); // NOI18N
        jMenuUtility.setText("Narzędzia");

        jMenuItemCheckHash.setText("Sprawdź plik");
        jMenuUtility.add(jMenuItemCheckHash);

        jMenuBar.add(jMenuUtility);

        jMenuSettings.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/wrench.png"))); // NOI18N
        jMenuSettings.setText("Ustawienia");

        jMenuItemSettings.setText("Opcje");
        jMenuItemSettings.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSettingsActionPerformed(evt);
            }
        });
        jMenuSettings.add(jMenuItemSettings);

        jMenuBar.add(jMenuSettings);

        jMenuHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/help.png"))); // NOI18N
        jMenuHelp.setText("Pomoc");

        jMenuPage.setText("Strona WWW");
        jMenuHelp.add(jMenuPage);

        jMenuAbout.setText("O programie");
        jMenuHelp.add(jMenuAbout);

        jMenuBar.add(jMenuHelp);

        setJMenuBar(jMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jMenuItemDownloadWindowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDownloadWindowActionPerformed
    navi.showPanel("downloadPanel");
}//GEN-LAST:event_jMenuItemDownloadWindowActionPerformed

    private void jMenuItemUploadWindowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUploadWindowActionPerformed
        navi.showPanel("uploadPanel");
    }//GEN-LAST:event_jMenuItemUploadWindowActionPerformed

    private void jMenuItemUploadWizzardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUploadWizzardActionPerformed
        navi.showPanel("uploadWizzard");
    }//GEN-LAST:event_jMenuItemUploadWizzardActionPerformed

    private void jMenuItemSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSettingsActionPerformed
        navi.showPanel("optionsPanel");
    }//GEN-LAST:event_jMenuItemSettingsActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Main().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private pear.gui.DownloadPanel downloadPanel;
    private javax.swing.JMenuItem jMenuAbout;
    private javax.swing.JMenuBar jMenuBar;
    private javax.swing.JMenu jMenuDownload;
    private javax.swing.JMenu jMenuHelp;
    private javax.swing.JMenuItem jMenuItem;
    private javax.swing.JMenuItem jMenuItemAddFile;
    private javax.swing.JMenuItem jMenuItemCheckHash;
    private javax.swing.JMenuItem jMenuItemDownloadWindow;
    private javax.swing.JMenuItem jMenuItemSettings;
    private javax.swing.JMenuItem jMenuItemUploadWindow;
    private javax.swing.JMenuItem jMenuItemUploadWizzard;
    private javax.swing.JMenuItem jMenuPage;
    private javax.swing.JMenu jMenuSettings;
    private javax.swing.JMenu jMenuUpload;
    private javax.swing.JMenu jMenuUtility;
    private javax.swing.JPanel mainPanel;
    // End of variables declaration//GEN-END:variables
}
